import scrapy


class BookSpider(scrapy.Spider):
    name = "book"
    allowed_domains = ["dangdang.com"]
    start_urls = ["https://category.dangdang.com/cid4008149.html"]

    def parse(self, response):
        lis = response.xpath("//ul[@class='bigimg cloth_shoplist']/li")
        for li in lis:
            print(li,'======')
            title = li.xpath('p[@class="name"]/a/text()').get()
            stars = li.xpath('p[@class="star"]/a/text()').get()
            shop = li.xpath('p[@class="link"]/a/text()').get()
            print(title,stars,shop,"========")

            yield {
                "title": title,
                "stars": stars,
                "shop": shop
            }
